<layout name="layout_common" />
<script type="text/javascript">
    //全局变量
    var GV = {
        DIMAUB: "{:G::$Cache['siteurl']}",
        FILE: "/index.php",
        REAL_FILE:"{:G::$Cache['siteurl']}/admin.php",
        TPL_COMMON: "__COMMON__",
        JS_ROOT: "__COMMON__/js/",
        TOKEN: ""
    };
</script>
<div class="user_main">
    <!------------------------------------------------------------------------------------------------------------------------->
    <div class="content_box">
        <div class="common_left">
            <p class="tit">注册会员</p>
            <form action="{:U('User/Public/doReg')}" method="post" name="form" id="form">
                <fieldset class="login register">
                    <p class="field"><span class="star">*</span><span>用户名</span><input type="text" name="uname" class="field_text" value="" /></p>
                    <p class="field">
                        <span class="star">*</span><span>密码</span><input type="password" name="password" class="field_text" value="" />
                    </p>
                    <p class="field">
                        <span class="star">*</span><span>确认密码</span><input type="password" name="repassword" class="field_text" value="" /></p>
                    <p class="field">
                        <span class="star">*</span><span>Email</span><input type="text" name="email" class="field_text" value="" />
                    </p>
                    <p class="field" id="userType">
                        <span class="star">*</span><span>会员类型</span>
                        <select name="type" class="field_text" onchange="userType(this)" >
                            <option value="user">普通会员</option>
                            <option value="shop">商户会员</option>
                        </select>
                    </p>
                    <p class="field shop_input">注册商户会员需提交下列资料，后台审核通过才可登陆</p>
                    <p class="field shop_input">
                        <span class="star">*</span><span>商户名称</span><input type="text" name="shop_name" class="field_text" value="" />
                    </p>
                    <p class="field shop_input">
                        <span class="star">*</span><span>商户地址</span><input type="text" name="shop_address" class="field_text" value="" />
                    </p>
                    <p class="field shop_input">
                        <span class="star">*</span><span>联系人</span><input type="text" name="link_man" class="field_text" value="" />
                    </p>
                    <p class="field shop_input">
                        <span class="star">*</span><span>联系电话</span><input type="text" name="link_phone" class="field_text" value="" />
                    </p>
                    <input class="button" type="submit" value="注册" />
                </fieldset>
            </form>
        </div>
        <!-------------------------------------------------------------------------------------------------------------->
        <div class="common_right">
            <div class="Cad"><img src="__PUBLIC_HOME__/images/ad5.jpg" /></div>
            <div class="Cad martop10"><img src="__PUBLIC_HOME__/images/ad6.jpg" /></div>
            <div class="CR_title"><i><a href="{:U('Home/Search/index')}">更多&gt;&gt;</a></i><strong>推荐信息</strong></div>

            <ul class="Recommend_information">
                <volist name="rounddz" id="rdz">
                    <li>
                        <div class="img"><img src="{$rdz.img_url}"></div>
                        <dl>
                            <dt><a href="{:U('Home/Dazhe/show', array('id'=>$rdz['dazhe_id']))}">{$rdz.title}</a></dt>
                            <dd class="s">{$rdz.user_id|getUserName}</dd>
                            <dd>时间：{$rdz.create_time|date="Y-m-d", ###}</dd>
                        </dl>
                    </li>     
                </volist>   
            </ul>
        </div>
    </div>
    <!------------------------------------------------------------------------------------------------------------------------->
</div>
<script type="text/javascript">
    userType();
    function userType(){
        var uType = $("select[name='type']").val();
        var html;
        if(uType == 'shop'){
            $(".shop_input").show();
        }else{
            $(".shop_input").hide();
        }
    }
    function CheckMail(mail) {
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(mail)) return true;
        else {
            return false;
        }
    }
    $(document).ready(function(e) {
        $("#form").submit(function(e) {
            if ($("input[name=uname]").val() == "") {
                alert("请填写用户名");
                $("input[name=uname]").focus();
                return false;
            }
            if ($("input[name=password]").val() == "") {
                alert("请填写密码");
                $("input[name=password]").focus();
                return false;
            }
            if ($("input[name=password]").val() != $("input[name=repassword]").val()) {
                alert("确认密码错误");
                $("input[name=repassword]").focus();
                return false;
            }
            if ($("input[name=email]").val() == "" || 　!CheckMail($("input[name=email]").val())) {
                alert("请输入正确的email");
                $("input[name=email]").focus();
                return false;
            }
            return true;
        });
        $("#submit").click(function() {
            $("#form").submit();
            return false;
        });
    });
</script>
